-
Notifications
You must be signed in to change notification settings - Fork 230
Add --no-wait option to azd down command #5217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>
Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>
// Create a new context that won't be cancelled when the parent context is done | ||
newCtx := context.Background() | ||
// Run the destroy operation in a goroutine and don't wait for it to complete | ||
go func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot In a Go, when the main function reaches the end, the program exits immediately—even if there are running goroutines in the background. Go does not automatically wait for them to finish.
The Azd down command not only triggers and handles deleting resources, it also purge any soft-deleted resources like KeyVault. AZD can only call the delete requests without waiting, but that would sacrifice the purge operation, leaving soft-deleted resources, which would block running azd up again, as some resources' name would be in deleted mode, blocking a new resource to use the same name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out. I've fixed the implementation in 6366171 to address the issue with goroutines exiting prematurely. Now when --purge
is true, the command will not use the async behavior even if --no-wait
is specified, ensuring critical purge operations complete. I've also updated the help text and output messages to explain this behavior to users.
Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
This PR adds a
--no-wait
option to theazd down
command, which allows users to start the resource deletion process without waiting for it to complete. This is particularly useful for workflows that need to clean up multiple environments, as requested in the issue.Changes
noWait
flag to thedownFlags
struct and bound it to the--no-wait
command line optionDestroyOptions
struct to include anoWait
field and added a getter method for itDestroy
method in the provisioning manager to support asynchronous operation whennoWait
is trueExample Usage
To start resource deletion without waiting for completion:
This command will return immediately after initiating the deletion process, allowing the user to continue working while Azure resources are being cleaned up in the background.
Fixes #5166.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
aka.ms
./azd down --help
(dns block)downloads.bicep.azure.com
/tmp/go-build1523196349/b448/bicep.test -test.testlogfile=/tmp/go-build1523196349/b448/testlog.txt -test.paniconexit0 -test.timeout=10m0s
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.